#pragma once
#include "../functions.h"

void logarithmic() {
  const short operation = get_choice(
      "Операция", {"Логарифм", "Натуральный логарифм", "Десятичный логарифм"});
  const double a = numeric_input("Число");

  string function, function_interpretation;
  double operation_result;
  int b;

  switch (operation) {
    case 1:
      b = numeric_input("Основание");
      function = "log" + get_subscript(b);
      operation_result = log(a) / log(b);
      break;
    case 2:
      function_interpretation = "ln";
      function = "log" + get_subscript("e");
      operation_result = log(a);
      break;
    case 3:
      function_interpretation = "lg";
      function = "log" + get_subscript(10);
      operation_result = log10(a);
      break;
  }
  if (!function_interpretation.empty())
    print_equation({function_interpretation, "(", a, ")", ""});

  print_equation({function, a, operation_result});
}